package Model;

import java.io.*;

/**Classe qui définit l'objet personne
 * **/
public class Person 
{
	public String  Firstname;
	public String  Lastname;
	private String Homeaddress;
	private String Companyaddress;
	private String Phonemobile;
	private String Phonehome;
	private String Homepage;
	private String EmailPro;
	private String EmailPerso;
	private String Fblink;
    private String photo;
    private String Group;
    
    

	/**Getter qui retourne l'élément indique
	 * */
	 public String getFirstname() 
	 {
		return Firstname;
	}

		/**Setter qui retourne l'élément indique
		 * */
	public void setFirstname(String firstname) {
		Firstname = firstname;
	}

	/**Getter qui retourne l'élément indique
	 * */
	public String getLastname() {
		return Lastname;
	}

	/**Setter qui retourne l'élément indique
	 * */
	public void setLastname(String lastname) {
		Lastname = lastname;
	}

	/**Getter qui retourne l'élément indique
	 * */
	public String getHomeaddress() {
		return Homeaddress;
	}

	/**setter qui retourne l'élément indique
	 * */
	public void setHomeaddress(String homeaddress) {
		Homeaddress = homeaddress;
	}

	/**Getter qui retourne l'élément indique
	 * */
	public String getCompanyaddress() {
		return Companyaddress;
	}

	/**setter qui retourne l'élément indique
	 * */
	public void setCompanyaddress(String companyaddress) {
		Companyaddress = companyaddress;
	}

	/**Getter qui retourne l'élément indique
	 * */
	public String getPhonemobile() {
		return Phonemobile;
	}

	/**setter qui retourne l'élément indique
	 * */
	public void setPhonemobile(String phonemobile) {
		Phonemobile = phonemobile;
	}

	/**Getter qui retourne l'élément indique
	 * */
	public String getPhonehome() {
		return Phonehome;
	}

	/**Setter qui retourne l'élément indique
	 * */
	public void setPhonehome(String phonehome) {
		Phonehome = phonehome;
	}

	/**Getter qui retourne l'élément indique
	 * */
	public String getHomepage() {
		return Homepage;
	}

	/**Setter qui retourne l'élément indique
	 * */
	public void setHomepage(String homepage) {
		Homepage = homepage;
	}

	/**Getter qui retourne l'élément indique
	 * */
	public String getEmailPro() {
		return EmailPro;
	}

	/**Setter qui retourne l'élément indique
	 * */
	public void setEmailPro(String emailPro) {
		EmailPro = emailPro;
	}

	/**Getter qui retourne l'élément indique
	 * */
	public String getEmailPerso() {
		return EmailPerso;
	}

	/**Setter qui retourne l'élément indique
	 * */
	public void setEmailPerso(String emailPerso) {
		EmailPerso = emailPerso;
	}

	/**Getter qui retourne l'élément indique
	 * */
	public String getFblink() {
		return Fblink;
	}

	/**setter qui retourne l'élément indique
	 * */
	public void setFblink(String fblink) {
		Fblink = fblink;
	}

	/**Getter qui retourne l'élément indique
	 * */
	public String getPhoto() {
		return photo;
	}

	/**Setter qui retourne l'élément indique
	 * */
	public void setPhoto(String photo) {
		this.photo = photo;
	}

	/**Getter qui retourne l'élément indique
	 * */
	public String getGroup() {
		return Group;
	}

	/**Setter qui retourne l'élément indique
	 * */
	public void setGroup(String Groupe) {
		this.Group = Groupe;
	}

	
	 /**Constructor of Person 0
	  * */
	public Person()
	{}
	 /**Constructor of Person
	  * */
	  public Person(String  Firstname,String  Lastname,String Homeaddress,String Companyaddress, 
			  String Phonemobile, String Phonehome,String Homepage,String EmailPro,String EmailPerso,String Fblink,String photo,String Group)
	  {
	    this.Firstname=Firstname;
	    this.Lastname=Lastname;
	    this.Homeaddress=Homeaddress;
	    this.Companyaddress=Companyaddress;
	    this.Phonemobile=Phonemobile;
	    this.Phonehome=Phonehome;
	    this.Homepage=Homepage;
	    this.EmailPro=EmailPro;
	    this.EmailPerso=EmailPerso;
	    this.Fblink=Fblink;
	    this.photo=photo;
	    this.Group=Group;
	  
	  }
	  /**Permit to do all modification of one person
	   * */
	  public Person Change(Person p,String  Firstname,String  Lastname,String Homeaddress,String Companyaddress, 
			  String Phonemobile, String Phonehome,String Homepage,String EmailPro,String EmailPerso,String Fblink,String photo,String Group)
	  {
		    p.Firstname=Firstname;
		    p.Lastname=Lastname;
		    p.Homeaddress=Homeaddress;
		    p.Companyaddress=Companyaddress;
		    p.Phonemobile=Phonemobile;
		    p.Phonehome=Phonehome;
		    p.Homepage=Homepage;
		    p.EmailPro=EmailPro;
		    p.EmailPerso=EmailPerso;
		    p.Fblink=Fblink;
		    p.photo=photo;
		    p.Group=Group;
		    return p;
	  }
	 
	

	

	 
	
	public boolean duplication_picture( File source, File destination )
	{//Methode permettant la copie d'un fichier
		boolean resultat = false;

		// Declaration des flux
		java.io.FileInputStream sourceFile=null;
		java.io.FileOutputStream destinationFile=null;
		try 
			{
			// Création du fichier :
			destination.createNewFile();
			// Ouverture des flux
			sourceFile = new java.io.FileInputStream(source);
			destinationFile = new java.io.FileOutputStream(destination);
			// Lecture par segment de 0.5Mo
			byte buffer[]=new byte[512*1024];
			int nbLecture;
			while( (nbLecture = sourceFile.read(buffer)) != -1 ) 
				{
				destinationFile.write(buffer, 0, nbLecture);
				}

		// Copie réussie
		resultat = true;
			} 
			catch( java.io.FileNotFoundException f ) 
			{
			} 
				catch( java.io.IOException e ) 
				{
				} 
		finally 
		{
		// Quoi qu'il arrive, on ferme les flux
		try 
			{
			sourceFile.close();
			} 
		
		catch(Exception e) 
			{
				
			}
		try 
			{
			destinationFile.close();
			} 
		catch(Exception e) 
			{ 
				
			}
		}
		return( resultat );
		}

	
	



}
